<template lang="">
    <div class='good'>
        <div class='box'>
            <img :src="good.img" @click='skipToDetail'>
        </div>
    </div>
</template>

<script>
export default {
    props:{  //接受父组件传过来的
        good:{
            type:Object,
            required:true
        }
    },
    methods:{
        skipToDetail(){
            this.$router.push('/detail/'+this.good._id)
        }
    }
}
</script>

<style lang="scss">
.good {
    display: inline-block;
    width: 5rem;
    height: 5rem;
    border: 1px solid orange;
    box-sizing: border-box;
.box {
    &>img {
        display: block;
        width: 100%;
        height: 100%;
    }
}
}
</style>